package com.enjoyor.soa.traffic.rest.efoms.dubbo.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.enjoyor.soa.traffic.api.service.dubbo.efoms.IDubboFaultHourCollectService;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IFaultHourCollectConsumeService;
import com.enjoyor.soa.traffic.util.enums.EnumAppCode;
import com.enjoyor.soa.traffic.util.helper.ResultHelper;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;
import org.springframework.stereotype.Component;

@Component
public class FaultHourCollectConsumeService implements IFaultHourCollectConsumeService {

	@Reference(version = "1.0.0",timeout = 10000)
    private IDubboFaultHourCollectService dubboFaultHourCollectService;
    
    /**
     * 查询设备异常数据
     * @param faulHourId 异常分时编号
     * @param devCategoryCode 设备种类编号
     * @param devTypeCode 设备类型编号
     * @param collectStartTime 统计开始时间
     * @param collectEndTime 统计结束时间
     * @return
     */
    @Override
    public ResultPojo selectFaultHourCollectList(String devCategoryCode, String devTypeCode,
			String collectStartTime, String collectEndTime) {
        ResultPojo resultPojo = new ResultPojo();
        try {
			resultPojo = dubboFaultHourCollectService.selectFaultHourCollectList(devCategoryCode,
					devTypeCode, collectStartTime, collectEndTime);
		}catch (Exception e ){
            e.printStackTrace();
            return ResultHelper.getResult(e,EnumAppCode.OPERATOR_FAILURE);
        }
        return resultPojo;
    }
    
    /**
     * 统计当前时间实时异常数
     * @param devCategoryCode 设备种类编号
     * @param devTypeCode 设备类型编号
     * @return
     */
    @Override
	public ResultPojo selectFaultRealCollectList(String devCategoryCode, String devTypeCode){
        ResultPojo resultPojo = new ResultPojo();
        try {
			resultPojo = dubboFaultHourCollectService.selectFaultRealCollectList(devCategoryCode, devTypeCode);
		}catch (Exception e ){
            e.printStackTrace();
            return ResultHelper.getResult(e,EnumAppCode.OPERATOR_FAILURE);
        }
        return resultPojo;
    }
}
